/**
 * 泛娱区块链 - RouterConfig
 * http://menger.me
 * @大梦
 */

'use strict';

import {
    createAppContainer,
    createBottomTabNavigator,
    createStackNavigator,
    StackViewTransitionConfigs
} from 'react-navigation'
import {configRouter, tabOptions} from './RouterTool';
// 首页
import Home from '../page/home/Home';
// 快讯
import NewsFlash from '../page/newsflash/NewsFlash';
// 行情
import Quotation from '../page/quotation/Quotation';
// 发现
import Find from '../page/find/Find';
// 我的
import Mine from '../page/mine/Mine';
// 登录
import Login from '../page/login/Login'
//绑定手机号
import BindingPhone from '../page/login/BindingPhone'
//文章详情
import ArticleDetails from '../page/detail/ArticleDetails'
//最新专题
import NewWest from '../page/find/NewWest'
//专题详情
import WestDetails from '../page/find/WestDetails'
//设置
import Settings from '../page/mine/Settings'
//收藏
import MyCollection from '../page/mine/MyCollection'
//我的关注与粉丝
import MyFollowFans from '../page/mine/MyFollowFans'
//我的资产
import MyAssets from '../page/mine/MyAssets'
//与我相关
import AboutMe from '../page/mine/AboutMe'
//反馈意见
import FeedBack from '../page/mine/FeedBack'
//关于我们
import AboutOur from '../page/mine/AboutOur'
//修改密码
import ChangePwd from '../page/mine/ChangePwd'
//积分商城
import PointShopping from "../page/shopping/PointShopping";
//商品详情
import GoodsDetail from "../page/shopping/GoodsDetail";
//积分兑换
import PointExchange from "../page/shopping/PointExchange";
//商城积分明细
import PointDetail from "../page/shopping/PointDetail";
//个人资料修改
import EditInfo from "../page/mine/EditInfo";
//最新专题
import LatestSubjects from "../page/find/LatestSubjects";
//自由论坛
import FreeForumList from "../page/find/FreeForumList";
//专题详情
import SubjectDetail from "../page/find/SubjectDetail";
//发布帖子
import PublishNote from "../page/find/PublishNote";
//视频详情
import VideoDetail from "../page/detail/VideoDetail";
//WebView
import WebPage from "../page/webview/WebPage";
//评论列表
import CommentList from "../page/detail/CommentList";
//搜索页
import SearchPage from "../page/home/SearchPage";
//回复列表
import ReplyList from "../page/detail/ReplyList";
//我的发布
import MyPublish from "../page/mine/MyPublish";
//发表文章
import PublishArticle from "../page/mine/PublishArticle";
//发表视频
import PublishVideo from "../page/mine/PublishVideo";
//个人中心
import UserCenter from "../page/mine/UserCenter";
//论坛详情
import TopicDetail from "../page/detail/TopicDetail";
//最新详情
import NewestArticleDetail from "../page/detail/NewestArticleDetail";

const TabNavigator = createBottomTabNavigator({
    Home: {
        screen: Home,
        navigationOptions: tabOptions({
            title: '主页',
            normalIcon: Images.icon_tabbar_home,
            selectedIcon: Images.icon_tabbar_home_cur
        })
    },
    NewsFlash: {
        screen: NewsFlash,
        navigationOptions: tabOptions({
            title: '快讯',
            normalIcon: Images.icon_tabbar_news_flash,
            selectedIcon: Images.icon_tabbar_news_flash_cur
        })
    },
    Quotation: {
        screen: Quotation,
        navigationOptions: tabOptions({
            title: '行情',
            normalIcon: Images.icon_tabbar_quotation,
            selectedIcon: Images.icon_tabbar_quotation_cur
        })
    },
    Find: {
        screen: Find,
        navigationOptions: tabOptions({
            title: '发现',
            normalIcon: Images.icon_tabbar_find,
            selectedIcon: Images.icon_tabbar_find_cur
        })
    },
    Mine: {
        screen: Mine,
        navigationOptions: tabOptions({
            title: '我的',
            normalIcon: Images.icon_tabbar_mine,
            selectedIcon: Images.icon_tabbar_mine_cur
        })
    },
}, {
    initialRouteName: 'Home',
    tabBarOptions: {
        showIcon: true,
        indicatorStyle: {height: 0},
        activeTintColor: "#ffa64f",
        style: {
            backgroundColor: "#fff"
        },
        tabStyle: {
            margin: 2,
        },
    },
    lazy: true, //懒加载
    swipeEnabled: false,
    animationEnabled: false, //关闭安卓底栏动画
    tabBarPosition: "bottom",

});


const StackNavigator = createStackNavigator(configRouter({
    Tab: {screen: TabNavigator},
    Login: {screen: Login},
    BindingPhone: {screen: BindingPhone},
    ArticleDetails: {screen: ArticleDetails},
    NewWest: {screen: NewWest},
    WestDetails: {screen: WestDetails},
    Settings: {screen: Settings},
    MyCollection: {screen: MyCollection},
    MyFollowFans: {screen: MyFollowFans},
    MyAssets: {screen: MyAssets},
    AboutMe: {screen: AboutMe},
    AboutOur: {screen: AboutOur},
    FeedBack: {screen: FeedBack},
    ChangePwd: { screen: ChangePwd },
    PointShopping: {screen:PointShopping},
    GoodsDetail: {screen:GoodsDetail},
    PointExchange: {screen:PointExchange},
    PointDetail: {screen:PointDetail},
    EditInfo: {screen: EditInfo},
    LatestSubjects: {screen: LatestSubjects},
    FreeForumList: {screen: FreeForumList},
    SubjectDetail: {screen: SubjectDetail},
    PublishNote: {screen: PublishNote},
    VideoDetail: {screen: VideoDetail},
    WebPage: {screen: WebPage},
    CommentList: {screen: CommentList},
    ReplyList: {screen: ReplyList},
    SearchPage: {screen: SearchPage},
    MyPublish: {screen: MyPublish},
    PublishArticle: {screen: PublishArticle},
    PublishVideo: {screen: PublishVideo},
    UserCenter: {screen: UserCenter},
    TopicDetail: {screen: TopicDetail},
    NewestArticleDetail: {screen: NewestArticleDetail},
}), {
    initialRouteName: 'Login',
    // initialRouteName: 'Find',
    initialRouteParams: {},
    defaultNavigationOptions: {
        header: null,
        gesturesEnabled: true
    },
    cardStyle: {
        backgroundColor: Theme.pageBackgroundColor,
    },
    cardShadowEnabled: false,
    cardOverlayEnabled: true,
    transitionConfig: (transitionProps, prevTransitionProps) => {
        const params = transitionProps && transitionProps.scene.route.params;
        const prevParams = prevTransitionProps && prevTransitionProps.scene.route.params;
        const isModal = params && params.screenInterpolator === 'modal' || prevParams && prevParams.screenInterpolator === 'modal';
        return isModal ? StackViewTransitionConfigs.ModalSlideFromBottomIOS : StackViewTransitionConfigs.SlideFromRightIOS;
    }
});

const AppNavigationContainer = createAppContainer(StackNavigator);

export {AppNavigationContainer};
